package com.sqin.taskflow.task;

import com.sqin.taskflow.config.TaskFlowConfig;
import com.sqin.taskflow.exception.WorkflowException;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;

@Slf4j
public class SubMultiTask extends SingleTask {

    public SubMultiTask(String name) {
        super(name);
    }

    @Override
    public void run() {
        TaskFlowConfig.listen.beforeExecute(this);

        try{
            this.result = this.execute();
            TaskFlowConfig.listen.executeResult(this);
        }catch (Exception e){
            this.result = e;
            TaskFlowConfig.listen.exception(this,e);
        }
        TaskFlowConfig.listen.afterExecute(this);
    }
}
